/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.risk.mapper;


import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.koron.risk.bean.CorpBean;

public interface CorpManagementMapper {

	@Select("select count(*) from application_corp where corp_code=#{corpCode}")
	public Integer queryAppCorp(@Param("corpCode")String corpCode);


	@Insert("insert into application_corp(id,add_user,add_time,corp_code,corp_name,short_code,latitude,longitude) values (#{id},#{addUser},#{addTime},#{corpCode},#{corpName},#{shortCode},#{latitude},#{longitude})")
	public Integer insertCorp(CorpBean bean);

	@Select("select * from application_corp")
	public List<CorpBean> list();

	@Select("select * from application_corp where corp_code=#{corpCode}")
	public CorpBean get(@Param("corpCode")String corpCode);

	@Update("update application_corp set update_user=#{updateUser},update_time=#{updateTime},attachment=#{attachment},description=#{description}," +
			"general_manager=#{generalManager},general_manager_name=#{generalManagerName}," +
			"chairman=#{chairman},chairman_name=#{chairmanName}," +
			"mss_general_manager=#{mssGeneralManager},mss_general_manager_name=#{mssGeneralManagerName} where corp_code=#{corpCode}")
	public Integer update(CorpBean bean);

	@Select("select * from application_corp where id=#{id}")
	public CorpBean getOneById(@Param("id")String id);

	@Select("select corp_code from safety_base_sys.district_corp_relation")
	List<String> noAvailableCorpCodes();


}
